//
//  NWAddressRequest.m
//  KuWoCan
//
//  Created by hwd on 17/3/23.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "NWAddressRequest.h"

@implementation NWAddressRequest

//获取所有用户地址
- (void)startRequestGetAllAddressWithUserId:(NSString *)userId
{
    _showError = YES;
    _showLoading = YES;
    _path = NWAddressGetAll_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"userId":userId}];
    
    _params = dic;
    [self startPost];
}

/*
 userId	string	是	用户Id	123456
 name	string	是	姓名	张三
 phone	string	是	手机号码	18086302679
 region	string	是	地区	湖北省武汉市洪山区
 address	string	是	详细地址	光谷大道未来之光
 */

//添加用户地址
- (void)startRequestAddAddressWithUserId:(NSString *)userId name:(NSString *)name phone:(NSString *)phone region:(NSString *)region address:(NSString *)address
{
    _showError = YES;
    _showLoading = YES;
    _path = NWAddressAdd_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"userId":userId,@"name":name,@"phone":phone,@"region":region,@"address":address}];
    
    _params = dic;
    [self startPost];
}

//修改用户地址
- (void)startRequestChangeAddressWithAID:(NSString *)aID name:(NSString *)name phone:(NSString *)phone region:(NSString *)region address:(NSString *)address
{
    _showError = YES;
    _showLoading = YES;
    _path = NWAddressEdit_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":aID,@"name":name,@"phone":phone,@"region":region,@"address":address}];
    
    _params = dic;
    [self startPost];
}

//设置默认用户地址
- (void)startRequestSetDefaultAddressWithUserId:(NSString *)userId aId:(NSString *)aId
{
    _showError = YES;
    _showLoading = YES;
    _path = NWAddressDefault_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"userId":userId,@"id":aId}];
    
    _params = dic;
    [self startPost];
}

//删除用户地址
- (void)startRequestDeleteAddressWithAId:(NSString *)aId
{
    _showError = YES;
    _showLoading = YES;
    _path = NWAddressDelete_Path;
    
    NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:@{@"id":aId}];
    
    _params = dic;
    [self startPost];
}

@end
